package com.rtx.edi.platform.express.auth.controller;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rtx.edi.model.express.auth.dto.PlExpressTemplateDto;
import com.rtx.edi.model.express.auth.po.PlExpressTemplate;
import com.rtx.edi.model.response.EdiResponse;
import com.rtx.edi.platform.express.auth.service.PlExpressTemplateService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = {"面单模板信息"})
@RestController
@RequestMapping("/v1/plExpressTemplate")
public class PlExpressTemplateController {
	
	@Autowired
	private PlExpressTemplateService plExpressTemplateService;
	
	@ApiOperation(value = "面单模板信息", notes = "面单模板信息")
    @PostMapping("qryPlExpressTemplateList")
	public EdiResponse qryPlExpressTemplate(@RequestBody PlExpressTemplateDto dto) {
		PlExpressTemplate req= new PlExpressTemplate();
		BeanUtils.copyProperties(dto,req);
		Page<PlExpressTemplate> pageParam = new Page<>(dto.getPageNum(),dto.getPageSize());
		plExpressTemplateService.selectByPage(pageParam, req);
		return EdiResponse.success().data("page",pageParam);
	}
	
	@ApiOperation(value = "面单模板信息", notes = "面单模板信息")
    @PostMapping("qryPlExpressTemplateById")
	public EdiResponse qryPlExpressTemplateById(@RequestBody PlExpressTemplateDto dto) {
		
		return EdiResponse.success().data("item",plExpressTemplateService.getById(dto.getId()));
		
	}
}
